[slug].tsx 944 B

123456789101112131415161718192021222324252627282930313233343536
  1. import { NextApiRequest, NextApiResponse } from 'next'
  2. import apiWrapper from '@/lib/api/apiWrapper'
  3. export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler)
  4. async function handler(req: NextApiRequest, res: NextApiResponse) {
  5. const { method } = req
  6. switch (method) {
  7. case 'GET':
  8. return handleGetAll(req, res)
  9. default:
  10. res.setHeader('Allow', ['GET'])
  11. res.status(405).json({ data: null, error: { message: `Method ${method} Not Allowed` } })
  12. }
  13. }
  14. const handleGetAll = async (_req: NextApiRequest, res: NextApiResponse) => {
  15. // Platform specific endpoint
  16. const response = {
  17. members: [],
  18. products: [],
  19. customer: {
  20. customer: {},
  21. subscriptions: {},
  22. total_paid_projects: 0,
  23. total_free_projects: 0,
  24. total_pro_projects: 0,
  25. total_team_projects: 0,
  26. total_payg_projects: 0,
  27. },
  28. }
  29. return res.status(200).json(response)
  30. }